<template>
	<view>
		<u-navbar title="氪气明细" titleStyle="color:#fff;" :placeholder="true" leftIconColor="#fff" :autoBack="true" bgColor="#1F1F1F">
			
		</u-navbar>
		
		<view class="keqi_list">
			
			<view class="item" v-for="(item,index) in tokenList" :key="index">
				<view class="info">
					<view class="name" >
						{{item.order_type_name}}
					</view>
					<view class="time">
						{{item.add_date}}
					</view>
				</view>
				<view class="infos">
					<view class="num red" v-if="item.type == 1">
						+ {{item.saas_token}}
					</view>
					<view class="num gray" v-else>
						- {{item.saas_token}}
					</view>
					<view class="balance">
						余额：{{item.balance}}
					</view>
				</view>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userId: '',
				userInfo: {},
				tokenList: {},
			}
		},
		onLoad() {
			this.userId = uni.getStorageSync('userId');
			this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
			this.getTokenList()
		},
		methods: {
			getTokenList() {
				uni.$u.http.get('/api/tk_token_list/' + this.userId + '?from=miniprogram&count=999').then(res => {
					console.log('系统配置接口----', res.data.data)
					this.tokenList = res.data.data
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.keqi_list{
		padding:10rpx 40rpx;
		.item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1rpx solid rgba(255, 255, 255, 0.15);
			padding:30rpx 0;
			.info{
				width: 100%;
				.name{
					font-size: 30rpx;
					color: #FFFFFF;
					line-height: 40rpx;
				}
				.time{
					color: #9B9B9B;
					font-size: 20rpx;
					margin-top: 10rpx;
				}
			}
			.infos{
				min-width: 150rpx;
				text-align: center;
				.num{
					flex-shrink: 0;
					margin-left: 30rpx;
					font-size: 32rpx;
					line-height: 50rpx;
					&.red{
						color: #FD2F58;
					}
					&.gray{
						color: #9B9B9B;
					}
				}
					
				.balance{
					color: #9B9B9B;
					font-size: 20rpx;
					text-align: center;
				}
			}
		}
	}
</style>
